package me.sealer.rmi.server.start;

import me.sealer.rmi.api.DemoService;
import me.sealer.rmi.server.service.impl.DemoServiceImpl;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

/**
 * 这里用一句话描述这个类的作用
 *
 * @author sealer
 * @email 1178884049@qq.com
 * @date 2018年12月07日
 */
public class ServiceStart {
    private static final String SERVER_REGISTER_NAME = "Service Rmi Demo";

    public static void main(String[] args) throws RemoteException {
        int servicePort = 12018;
        DemoService service = new DemoServiceImpl();
        UnicastRemoteObject.exportObject(service, servicePort);

        int registryPort = 1099;
        Registry registry = LocateRegistry.createRegistry(registryPort);
        registry.rebind(SERVER_REGISTER_NAME, service);
    }
}
